The map to the left shows culverts that have been identified and started down the path of assessment. These are ALL points that have been flagged as potential tidal culverts.
NOTE that there’s additional points that exist in the GIS file that had to be removed due to incorrect lat/lons these are listed below (might be blank if all have been fixed! (thanks Karen!).
The following crossing ID’s are errant points not displayed:
Crossing ID #:
| Tidal_ID |
|---|
The following crossing ID’s are flagged as duplicate:
| Tidal_ID |
|---|
| 2007 |
Missing datasheet for desktop and field assessment data{data-commentary-width=500}
These are locations that have no Tidal Crossing Assessment Workbooks associated with them OR the crossing ID field in either the shapefile or the workbooks are non-matching.
Are these areas that we are interested in assessing? Probably will want to add the ‘Priority Ranking’ from the Master Spreadsheet doc in there.
The table below will can either be copied-pasted or downloaded as an excel file that can be used to reference which crossings need to have a data sheet made up (or perhaps not…).
From these potential points priorities are mapped out based on proximity to important marsh complexes and partner input.
From the tidal assessment workbooks
Desktop assessments.
| Priority | n |
|---|---|
| 1 | 1 |
| Check partner priorities | 3 |
| High | 5 |
| High for partners | 2 |
| Medium-Not Priority | 8 |
| No | 4 |
| Partner | 2 |
| Yes | 41 |
| Yes | 1 |
| Yes, and partner | 1 |
| NA | 76 |
Here’s where some plots will live for seeing where missing bits are for iterative work flows.
---
title: "Tidal Culvert Project/Data Status"
output:
flexdashboard::flex_dashboard:
theme: spacelab
source: embed
---
```{r setup, include=FALSE}
# TODO: Move this code block to script and source in across multiple Rmds
library(flexdashboard)
library(readr)
library(readxl)
library(tidyxl)
library(unpivotr)
library(tidyverse)
library(sf)
library(mapview)
library(rstudio)
library(tncThemes)
library(plotly)
library(hrbrthemes)
library(leaflet)
library(knitr)
library(crosstalk)
library(magrittr)
knitr::read_chunk("code/rmdSetup.R") # read code chunks from external files to extend beyond multiple Rmds.
```
```{r directorySetup, message=FALSE, warning=FALSE, include=FALSE, paged.print=FALSE}
```
```{r spatialDataLoad, message=FALSE, warning=FALSE, include=FALSE, paged.print=FALSE}
```
```{r culvertData, message=FALSE, warning=FALSE, paged.print=FALSE}
```
Identifying Crossings
=========================================
Column
----------------------------------------------
### Locating Culverts
```{r message=FALSE, warning=FALSE, paged.print=FALSE}
# Crossings that have been IDed via ArcMap and from partners.
# TODO: Add layers for aerials
# TODO: Tidal stations - check windy API
basemap <- leaflet() %>%
addProviderTiles(providers$CartoDB.Positron, group = "Carto DB") %>%
addProviderTiles(providers$HikeBike.HillShading, options = providerTileOptions(opacity = 0.3), group = "Carto DB") %>%
addProviderTiles(providers$Esri.WorldImagery, group = "ESRI Aerials") %>%
addMouseCoordinates(style = "basic") %>%
addLayersControl(baseGroups = c("Carto DB", "ESRI Aerials"), overlayGroups = c("highlight"), position = "bottomright")
basemap %>%
addCircleMarkers(data = LIculvert_GISpts, ~Longitude, ~Latitude, radius = 3, fillOpacity = 0.75, fillColor = as.character(tnc_color("Indigo")), stroke = FALSE) %>%
addCircleMarkers(data = LIculvert_GISpts, ~Longitude, ~Latitude, radius = 4, fillOpacity = 1, fillColor = as.character(tnc_color("Red Rock")), stroke = FALSE, group = "highlight") %>%
hideGroup("highlight")
# map_assessedLItidalCulverts <- mapview(LIculvert_GISpts, label = as.character(LIculvert_GISpts$crossingID), cex = 4, alpha = 0.4, lwd = 0, col.regions = tnc_color("Indigo"))
#
# map_assessedLItidalCulverts
```
Column {.tabset .tabset-fade}
----------------------------------------------
### Potential Crossings
The map to the left shows culverts that have been identified and started down the path of assessment. These are _*ALL*_ points that have been flagged as potential tidal culverts.
_*NOTE*_ that there's additional points that exist in the GIS file that had to be removed due to incorrect lat/lons these are listed below (might be blank if all have been fixed! (thanks Karen!).
***
The following crossing ID's are errant points not displayed:
Crossing ID #:
`r kable(errorPts)`
***
The following crossing ID's are flagged as duplicate:
`r kable(duplicatePts)`
### Culverts Needing Corresponding Workbook
Missing datasheet for desktop and field assessment data{data-commentary-width=500}
```{r message=FALSE, warning=FALSE, paged.print=FALSE}
map_missingsDataPts <- mapview(LIculvert_GISpts %>% filter(!crossingID %in% LIculvertData$crossingID),
zcol = 'PriorityScore',
label = as.character(LIculvert_GISpts$crossingID), lwd = .5,
cex = 4, legend = TRUE, layer.name = "Culvert by Priority")
map_missingsDataPts
#TODO: Bring in the priority info from the "Master Spreadsheet"
```
These are locations that have no Tidal Crossing Assessment Workbooks associated with them _OR_ the crossing ID field in either the shapefile or the workbooks are non-matching.
Are these areas that we are interested in assessing? Probably will want to add the 'Priority Ranking' from the Master Spreadsheet doc in there.
The table below will can either be copied-pasted or downloaded as an excel file that can be used to reference which crossings need to have a data sheet made up (or perhaps not...).
```{r echo=FALSE, message=FALSE, warning=FALSE, paged.print=FALSE}
LIculvert_GISpts %>%
st_set_geometry(NULL) %>%
as.data.frame() %>%
filter(!crossingID %in% LIculvertData$crossingID) %>%
dplyr::select(crossingID, TNCPriorit, MarPriorit, PtrPriorit, PriorityScore) %>%
DT::datatable(rownames = FALSE,
extensions = list('Buttons'),
style="bootstrap", width="100%",
options = list(scrollY=300,
scroller=TRUE,
dom = 'Bfrtip',
buttons = list('copy', list(extend = 'collection',
buttons = c('excel'),
text = 'Download'
))
)
)
```
Data Needs
============================================================
### Prioritizing Assessments:
```{r}
map_assessedLItidalCulverts <- mapview(LIculvertData_location, zcol = "PriorityScore", cex = "PriorityScore", na.color = 'red')
marshMap <- mapview(priorityMarshes, zcol = "WETLAND_TY")
map_assessedLItidalCulverts + marshMap
```
***
From these potential points priorities are mapped out based on proximity to important marsh complexes and partner input.
Data Management/QA/Status
==================================================
Column
--------------------------------------------------
### Assessment Status:
```{r fig.height=6, fig.width=6, message=FALSE, warning=FALSE, paged.print=FALSE}
#TODO get this Assessed attribute from the culvertStatus file.
dataStatus_shared <- SharedData$new(LIculvertDataStatus_location)
completionMap <- basemap %>%
addCircleMarkers(data = dataStatus_shared, ~Longitude, ~Latitude, radius = 3, fillOpacity = 0.75, fillColor = as.character(tnc_color("Indigo")), stroke = FALSE) %>%
addCircleMarkers(data = dataStatus_shared, ~Longitude, ~Latitude, radius = 4, fillOpacity = 1, fillColor = as.character(tnc_color("Red Rock")), stroke = FALSE, group = "highlight") %>%
hideGroup("highlight")
completionPlot <- ggplot(dataStatus_shared, aes(x = fieldCompletion, y = DesktopCompletion, fill = fieldAssessed)) +
geom_jitter(stroke = 0, size = 2) +
theme_ipsum() +
coord_flip() +
labs(main = "Field Assessed", x = NULL) +
scale_fill_viridis_d() +
theme(legend.position = "bottom")
completionPlot %<>% ggplotly()
completionPlot %<>% layout(dragmode = "pan")
bscols(
completionMap,
ggplotly(completionPlot, tooltip = "crossingID", width = 300, height = 300, dynamicTicks = TRUE)
)
# mapview(dataStatus_shared, zcol = "fieldAssessed")
```
Column {.tabset}
--------------------------------------
### Assessment Completion
From the tidal assessment workbooks
### Assessment Status: Desktop Assesments
```{r message=FALSE, warning=FALSE, paged.print=FALSE}
mapview(LIculvertDataStatus_location, zcol = "DesktopComplete", layer.name = "Desktop Complete")
```
***
Desktop assessments.
```{r}
LIculvertDataStatus_location %>% as.data.frame %>% group_by(Priority) %>% tally() %>% kable()
```
### Missing data and project to do's
```{r echo=FALSE, fig.height=11, fig.width=11, message=FALSE, warning=FALSE, paged.print=FALSE}
library(naniar)
# gg_miss_upset(LIculvertData, nsets = n_var_miss(LIculvertData))
gg_miss_fct(LIculvertData, fct = crossingID) + theme_minimal() + theme(text = element_text(size = 8), axis.text.x = element_text(angle = 90, hjust = 1, size = 10))
```
***
Here's where some plots will live for seeing where missing bits are for iterative work flows.